#include <rtthread.h>
#include "E53_IS1.h"
#include "drv_lcd.h"

static struct rt_semaphore is1_sem;

static rt_err_t is1_recall(void *args)
{
    rt_kprintf("is1_recall-----------\r\n");
    rt_sem_release(&is1_sem);
    return RT_EOK;
}

int main(void)
{
    float ppm;
    rt_sem_init(&is1_sem, "is1_sem", 0, RT_IPC_FLAG_FIFO);
    E53_IS1_Init(is1_recall);
    while(1)
    {
        rt_sem_take(&is1_sem, RT_WAITING_FOREVER);
        if (E53_IS1_Read_Data() == 1)
        {
            lcd_show_string(80, 100, 24, "Alarm   ");
            E53_IS1_Beep_Set(ON);
        } else {
            lcd_show_string(80, 100, 24, "Safe   ");
            E53_IS1_Beep_Set(OFF);
        }
    }
}
